"""

套题详情页面  实训 、竞赛

"""
from selenium.webdriver.common.by import By

from pom.base import BaseDriver

class BankDetailPage(BaseDriver):
    def __init__(self, driver):
        super(BankDetailPage, self).__init__(driver)

    # 题库名称
    _bank_title = By.XPATH, '//div[@class="title f-f-1 f-fs-18 f-fwb f-wwb"]'

    # 题库简介
    _desc = By.XPATH, '//div[@class="descript f-m-t-20 f-wwb"]'

    # 镜像关联
    _image = By.XPATH, '//span[@class="s-fc-link"]'

    # 答题模式
    _answer_model = By.XPATH, '//form[@class="el-form el-form--inline"]//div[@class="el-form-item"][2]//span'


    # 状态 已发布、未发布
    _status = By.XPATH, '//form[@class="el-form el-form--inline"]//div[@class="el-form-item"][3]//span'

    # 相关附件
    _file = By.XPATH, '//form[@class="el-form el-form--inline"]//div[@class="el-form-item"][4]//span'

    # 其他说明
    _other_desc = By.XPATH, '//form[@class="el-form el-form--inline"]//div[@class="el-form-item"][5]//span'

    # 题目列表
    _question_list = By.XPATH, '//div[text()="题目列表"]'

    # 相关竞赛
    _related_competition = By.XPATH, '//div[text()="相关竞赛"]'

    # 添加题目
    _add_question_btn = By.XPATH, '//span[text()="添加题目"]/..'

    # 添加分组
    _add_section_btn = By.XPATH, '//span[text()="添加分组"]/..'

    # 分组名称
    _section_name = By.XPATH, '//div[@class="el-input el-input--medium"]/input'

    # 分组简介
    _section_desc = By.XPATH, '//div[@class="auto-textarea-wrapper content-input"]//textarea'

    # 分组保存
    _section_save_btn = By.XPATH, '//span[text()="保存"]'

    #分组返回
    _section_return_btn = By.XPATH, '//span[text()="返回"]'

    # @property
    # def (self):
    #     ele = self.find_ele(*)
    #     self.logger.info("")
    #     return ele


    @property
    def add_section_btn(self):
        ele = self.find_ele(*self._add_section_btn)
        self.logger.info("添加题目分组")
        return ele

    @property
    def add_question_btn(self):
        ele = self.find_ele(*self._add_question_btn)
        self.logger.info("添加题目按钮")
        return ele

    @property
    def question_list(self):
        ele = self.find_ele(*self._question_list)
        self.logger.info("查看题目列表")
        return ele

    @property
    def related_competition(self):
        ele = self.find_ele(*self._related_competition)
        self.logger.info("查看题库相关竞赛")
        return ele

    @property
    def other_desc(self):
        ele = self.find_ele(*self._other_desc)
        self.logger.info("查看其它说明")
        return ele

    # 发布按钮
    _publish_btn = By.XPATH, '//span[text()="发布"]'

    @property
    def publish_btn(self):
        ele = self.find_ele(*self.publish_btn)
        self.logger.info("发布按钮")
        return ele

    # 编辑按钮
    _edit_btn = By.XPATH, '//span[text()="编辑"]'

    @property
    def edit_btn(self):
        ele = self.find_ele(*self._edit_btn)
        self.logger.info("编辑题库按钮")
        return ele

    # 生成实训真题
    _converse_train = By.XPATH, '//button//span[text()="生成实训真题"]'

    @property
    def converse_train(self):
        ele = self.find_ele(*self._converse_train)
        self.logger.info("生成实训真题按钮")
        return ele

    # 下架
    _unpublish = By.XPATH, '//button//span[text()="下架"]'

    @property
    def unpublish(self):
        ele = self.find_ele(*self._unpublish)
        self.logger.info("")
        return ele

    # 更多操作
    _more_operation = By.XPATH, '//button//span[text()="更多操作"]'

    @property
    def more_operation(self):
        ele = self.find_ele(*self._more_operation)
        self.logger.info("点击更多操作按钮")
        return ele

    # 克隆
    _clone = By.XPATH, '//li[text()="克隆"]'

    @property
    def clone(self):
        ele = self.find_ele(*self._clone)
        self.logger.info("克隆按钮")
        return ele

    # 导入题目
    _import_question = By.XPATH, '//li[text()="导入题目"]'

    @property
    def import_question(self):
        ele = self.find_ele(*self._import_question)
        self.logger.info("导入题目")
        return ele

    # 导出
    _export = By.XPATH, '//li[text()="导出"]'

    @property
    def export(self):
        ele = self.find_ele(*self._export)
        self.logger.info("导出题库")
        return ele

    # 删除
    _delete_bank = By.XPATH, '//li[text()="删除"]'

    @property
    def delete_bank(self):
        ele = self.find_ele(*self._delete_bank)
        self.logger.info("删除题库按钮")
        return ele

    @property
    def file(self):
        ele = self.find_ele(*self._file)
        self.logger.info("查看相关附件")
        return ele

    @property
    def status(self):
        ele = self.find_ele(*self._status)
        self.logger.info("查看发布状态")
        return ele

    @property
    def image(self):
        ele = self.find_ele(*self._image)
        self.logger.info("查看关联镜像")
        return ele

    @property
    def desc(self):
        ele = self.find_ele(*self._desc)
        self.logger.info("查看简介")
        return ele

    @property
    def answer_model(self):
        ele = self.find_ele(*self._answer_model)
        self.logger.info("查看答题模式")
        return ele


    @property
    def bank_title(self):
        ele = self.find_ele(*self.bank_title)
        self.logger.info("查看题库名称")
        return ele